package com.htc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.htc.dao.ProductCommentMapper;
import com.htc.model.PageResult;
import com.htc.model.ProductComment;
import com.htc.model.request.ProductCommentRequest;
import com.htc.model.request.ProductRequest;

@Service
public class ProductCommentService{
	
	@Autowired
	private ProductCommentMapper productCommentMapper;

	public void add(  ProductComment t) {
		productCommentMapper.add(t);
	}

	public void update(  ProductComment t) {
		productCommentMapper.upadte(t);
	}

	public void del(int id) {
		productCommentMapper.del(id);
	}

	public PageResult< ProductComment> queryList(ProductCommentRequest request) {
		Page page = PageHelper.startPage(request.getPage(), request.getLimit());
		List<ProductComment> list =  productCommentMapper.queryList(request.convertToWhere());
		return new PageResult<ProductComment>(list, page.getTotal(), page.getPageSize(), page.getPageNum());
	}
	
	
	
}
